<template>
  <div>
    <h3>表格</h3>
    <!-- 组件名：el-table
                   data:数据绑定
                   el-table-column  列
                         label:标题
                         width:设置宽度
                         prop:对应该列的字段名
                         type:index  序号
           自定义列
               el-table-column
                   插槽：作用域插槽  v-slot="{$index,row}"
                       $index:索引
                       row:当前行数据
    -->
    <el-table :data="tableData" border>
      <el-table-column label="序号" type="index" />
      <el-table-column label="日期" prop="date" sortable />
      <el-table-column label="姓名" prop="name" />
      <el-table-column label="地址" prop="address" />
      <el-table-column label="操作" width="300px">
        <!-- <template v-slot="{ $index, row }"> -->
        <template>
          <!-- <div>{{ $index }}--------{{ row }}</div> -->
          <el-button type="success">分配权限</el-button>
          <el-button type="primary">编辑</el-button>
          <el-button type="danger">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
export default {
  data() {
    return {
      tableData: [
        {
          date: '2016-05-02',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1518 弄'
        },
        {
          date: '2016-05-04',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1517 弄'
        },
        {
          date: '2016-05-01',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1519 弄'
        },
        {
          date: '2016-05-03',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1516 弄'
        }
      ]
    }
  }
}
</script>
<style></style>
